import { ApiBase, Route, src, resHtml, valid } from 'koagun'
import { App, Ctx } from '../../app'

export class PatientApi extends ApiBase<App, Ctx> {
  constructor(app: App) {
    super(app)
    app.vite.include('patient', src('/services/patient/patient.vue'))
    app.vite.include('process', src('/services/patient/process.vue'))
    app.vite.include('history', src('/services/patient/history.vue'))
    app.vite.include('pDetail', src('/services/patient/detail.vue'))
  }

  public routes: Route<Ctx>[] = [{
    tags: ['view'],
    path: '/patient',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('patient', {}, '首页'))
  }, {
    tags: ['view'],
    path: '/patient/process',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('process', {}, '流程'))
  }, {
    tags: ['view'],
    path: '/patient/history',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('history', {}, '历史流程'))
  }, {
    tags: ['view'],
    path: '/patient/pDetail',
    middlewares: [],
    get: async (ctx: Ctx) => resHtml(ctx, await this.app.vite.render('pDetail', {}, '个人信息'))
  }]
}
